<%-- 
    Document   : sanphamtheoloaicontent
    Created on : Oct 7, 2011, 6:45:21 PM
    Author     : Administrator
--%>

<%@page import="hibernate.pojo.Chitietsanpham"%>
<%@page import="java.util.List"%>
<%@page import="hibernate.pojo.Sanpham"%>
<%@page import="org.hibernate.HibernateException"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div class="hastable">
    <form name="myform" class="pager-form" method="post" action="admindealprocesscontroller?action=addingdeal">
        <table id="sort-table"> 
            <thead> 
                <tr>
                    <th><input type="checkbox" value="check_none" onclick="this.value=check(this.form.list)" class="submit"/></th>
                    <th>Tên Sản Phẩm</th>
                    <th style="width:132px">Tùy Chỉnh</th>
                </tr>
            </thead> 
            <tbody>
                <%
                    try 
                    {
                        List<Sanpham> arrSanPham = (List<Sanpham>) request.getAttribute("DanhSachSanPhamTheoLoai");
                        Sanpham item0 = null;
                        if (arrSanPham != null) 
                        {
                            item0 = arrSanPham.get(0);
                            for (int i = 0; i < arrSanPham.size(); i++) 
                            {
                                Sanpham sanpham = arrSanPham.get(i);
                                int tinhTrangXoa = sanpham.getTinhTrangXoa();
                                String strTinhTrangXoa = "";
                                if(tinhTrangXoa==1)
                                {
                                    strTinhTrangXoa =   "<a class='btn_no_text btn ui-state-default ui-corner-all xtooltip' title='Xóa' href='admindealprocesscontroller?action=del&amp;catalogtype="+sanpham.getLoaisanpham().getTenTrang()+"&amp;masanpham="+sanpham.getMaSanPham()+"'>" +
                                                        "<span class='ui-icon ui-icon-circle-close'></span>" +
                                                        "</a>";
                                }
                                else
                                {
                                    strTinhTrangXoa =   "<a class='btn_no_text btn ui-state-default ui-corner-all tooltip' title='Không Xóa' href='admindealprocesscontroller?action=redel&amp;catalogtype="+sanpham.getLoaisanpham().getTenTrang()+"&amp;masanpham="+sanpham.getMaSanPham()+"'>" +
                                                        "<span class='ui-icon ui-icon-locked'></span>" +
                                                        "</a>";
                                }
                %>                
                <tr>
                    <td class="center"><input type="checkbox" value="1" name="list" class="checkbox"/></td> 
                    <td><%=sanpham.getTenSanPham()%></td>
                    <td>
                        <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" href="admindealprocesscontroller?action=updatingdeal&masanpham=<%=sanpham.getMaSanPham()%>">
                            <span class="ui-icon ui-icon-wrench"></span>
                        </a>
                        <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" href="admindealdetailcontroller?action=view&masanpham=<%=sanpham.getMaSanPham()%>">
                            <span class="ui-icon ui-icon-arrowthick-1-e"></span>
                        </a>
                        <%=strTinhTrangXoa%>
                    </td>
                </tr>
                <%
                            }
                        }
                %>                
            </tbody>
        </table>
    </form>
    <div align="right">
        <form id="form1" name="form1" method="post" action="admindealprocesscontroller?action=addingdeal">
            <input type="submit" name="button" id="button" value=""  style=" width: 112px; height: 32px; background:url(Admin/images/web/btn-themsanpham.gif) no-repeat;"/>
        </form>
    </div>
     
<%
        int soTrang = (Integer)request.getAttribute("SoTrang");
        if(soTrang>1)
        {
            //int next_pre = 0;
%>
            <div class="title title-spacing"><h3>Danh sách trang</h3>
            <ul class="pagination">
                <!--<li class="previous-off">&laquo;Previous</li>-->
                <!--<li class="next">&laquo;Previous</li>-->
            <%
                for(int i=1; i<=soTrang; i++)
                {
            %>
                    <!--<li class="active">1</li>-->
                    <li><a href="admincatalogcontroller?action=listdealbycatalog&catalogtype=<%=item0.getLoaisanpham().getTenTrang()%>&trang=<%=i%>"><%=i%></a></li>
            <%
                }
            %>                               
                <!--<li class="next"><a href="#">Next &raquo;</a></li>-->
            </ul>
            </div>
<%
        }
    }catch(Exception ex)
    {
        out.println(ex);
    }
%>
</div>
